﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;

namespace Web.Services
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IOperations" in both code and config file together.
    [ServiceContract(SessionMode=SessionMode.Required)]
    public interface IOperations
    {
        #region Login Handling - please do better in real life

        [OperationContract(IsInitiating=true, IsTerminating=false, IsOneWay=true)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        void Open(string session);

        [OperationContract(IsInitiating=false, IsTerminating=false, IsOneWay=true)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        void Login(string username, string password);

        [OperationContract(IsTerminating=true, IsInitiating=false, IsOneWay=true)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        void Close();

        #endregion

        [OperationContract(IsInitiating=false, IsTerminating=false)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        string SendSaudo(string receiver, string text);

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        void VoteSaudo(string key);

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json
        )]
        void CommentSaudo(string key, string text);
    }
}
